<template>
	<view class="house">
		<life-empty v-if="!repairList.length" url="/pkg-house/house-repair/house-repair" tip="你还没有报修房屋，请点击"
			linkText="跳转" @click-text="onClick">
		</life-empty>

		<view class="house-list" v-else>
			<repair-item :repairList="repairList" @click="goDetail"></repair-item>
			<life-button icon="../../static/icon/repair.png">在线报修</life-button>
		</view>
	</view>
</template>

<script>
	import {
		getRepairList
	} from '@/api/repair.js'
	export default {
		data() {
			return {
				repairList: [],
				// repairQuery: {
				// 	current: '1',
				// 	pageSize: '20'
				// }
			};
		},
		onLoad() {
			this.getRepairList()
		},
		methods: {
			onClick() {
				console.log('跳转')
			},
			goDetail(id) {
				uni.navigateTo({
					url: '/pkg-house/house-detail/house-detail?id=' + id
				})
			},
			async getRepairList() {
				const {
					data
				} = await getRepairList()
				console.log(data)
				this.repairList = data.rows
			}
		}
	}
</script>

<style lang="scss" scoped>
	.house {
		// height: 100%;
		background-color: #FAFAFA;
		padding: 0 20rpx 249rpx 20rpx;

		.house-list {
			::v-deep .u-swipe-action-item__content {
				background-color: unset !important;
			}

			::v-deep .u-swipe-action-item {
				background-color: #CC655E;
				border-radius: 16rpx;
				margin-bottom: 20rpx;
			}

			::v-deep .u-swipe-action {
				margin-bottom: 20rpx;
			}
		}
	}
</style>
